from .celery import app
from celery.utils.log import get_task_logger
import time
logger = get_task_logger(__name__)


@app.task
def add(x, y):
    sum_add = x + y
    logger.debug(f"sum_add: {sum_add}")
    return sum_add


@app.task
def callback(res, msg):
    logger.debug(f"{msg}: {str(res)}")


@app.task
def mul(y, x):
    logger.debug(f"Hello World:{y},{x}")
    res = y * x
    time.sleep(1)
    #raise Exception("str")
    return res


@app.task
def xsum(numbers):
    return sum(numbers)
